<div th:if="*{badges !=null and !badges.isEmpty()}" th:classappend="*{badges}"></div>
<div class="direct_mail" th:if="${product.isBroad}"></div>
<div class="image">
    <a th:href="@{*{url}}" target="_blank">
        <img th:if="*{media['primary']}" blc:src="@{/img/loader.gif}" th:alt="*{name}" th:title="*{name}" class="lazy"
             th:attrappend="data-original=@{*{media['primary'].url} + '?browse'}" />
        <div class="price" th:if="${#object instanceof T(org.broadleafcommerce.core.catalog.domain.ProductBundle)}">
            <div blc:fsprice="*{salePrice}" th:if="*{onSale}" th:classappend="*{defaultSku.onSale}? 'sale'"></div>
            <div blc:fsprice="*{retailPrice}" th:classappend="*{onSale}? 'has-sale'"></div>
        </div>
    </a>
</div>
<div class="content">
    <div class="title" th:text="*{name}"></div>
    <!--<p class="pro_desc" th:text="*{description}"></p>-->
    <!--/*-->
    <div class="" th:if="${quantities != null and quantities.containsKey(product.id)}">
        <span th:text="#{product.sold}">Sold</span>
        <span th:text="${quantities.get(product.id)}"></span>
    </div>
    <!--*/-->
</div>
<div th:class="*{'productActions productActions' + id}" th:with="checkInventory=*{defaultSku.inventoryType?.type == 'CHECK_QUANTITY'},
              availableInventory=${checkInventory ? #object.defaultSku.quantityAvailable != null and #object.defaultSku.quantityAvailable != 0 : true},
              inCart=${cart.containsSku(#object.defaultSku) and #lists.isEmpty(product.productOptions)}">
    <div class="price" th:unless="${#object instanceof T(org.broadleafcommerce.core.catalog.domain.ProductBundle)}">
        <div blc:fsprice="*{defaultSku.salePrice.add(defaultSku.calculatedShippmentFee)}" th:if="*{defaultSku.onSale}" th:classappend="*{defaultSku.onSale}? 'sale'"></div>
        <div blc:fsprice="*{defaultSku.retailPrice.add(defaultSku.calculatedShippmentFee)}" th:classappend="*{defaultSku.onSale}? 'has-sale'"></div>
    </div>
    <div th:if="${checkInventory and !availableInventory}" class="out_of_stock">
        <a disabled="disabled" class="inCart">已售完</a>
    </div>
    <div class="add_to_cart" th:classappend="${!availableInventory}? ' hidden'">
        <blc:form method="POST" th:action="@{/cart/add}" target="_blank">
            <input type="hidden" name="productId" th:value="*{id}" />
            <input type="hidden" name="quantity" value="1" />
            <input type="hidden" name="hasProductOptions" th:value="*{!#lists.isEmpty(productOptions)}" />
            <input type="submit" class="addToCart" th:value="#{product.buyNow}" />
        </blc:form>
    </div>
</div>
<div style="display: none;" th:id="*{'productOptions' + id}" class="product-options modal">
    <h3 th:text="*{name}"></h3>
    <div class="product-options" th:substituteby="catalog/partials/productOptions" />
    <input type="button" class="addToCart" th:value="#{product.buyNow}" />
</div>
